
//1441.用栈操作构建数组
class Solution {
public:
    vector<string> buildArray(vector<int>& target, int n) {
        int len=target.size(),j=0;
        vector<string> ret;
        for(int i=1;i<=n&&j<len;i++)
        {
            ret.push_back("Push");   //模拟push插入
            if(i!=target[j])           //当前数字不在target中就pop
            ret.push_back("Pop");  
            else j++;                  //否则找下一个target  
        } 
        return ret;
    }
};